package com.naiterui.ehp.bs.im.remote;

import java.util.Map;

import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.im.network.protocl.Session;
import com.naiterui.ehp.bs.im.network.protocl.SessionDetails;
import com.naiterui.ehp.bs.im.vo.ConsultPayVO;
import com.naiterui.ehp.bs.im.vo.dto.RecomUserInfoDTO;

/**
 * 对需要远程调用的接口进行封装
 */
public interface IRemoter {

    /**
     * 向微信接口发送消息（默认存入IM历史记录）
     */
    boolean sendMsgToWx(Integer msgType, Long fromId, Long toId, String content, Session session);

    /**
     * 向微信接口发送消息（默认存入IM历史记录）
     */
    boolean sendMsgToWx(String msgId, String batchId, Integer msgType, Long fromId, Long toId, String content, Session session);

    /**
     * 向微信接口发送消息（可选是否入IM消息表）
     */
    boolean sendMsgToWx(String msgId, String batchId, Integer msgType, Long fromId, Long toId, String content, Session session,
                        boolean ignoreSession);

    /**
     * 指定用户推送push消息
     */
    void pushMsg(Long doctorId, String msg, String userType, String linkUrl) throws BusinessException;

    /**
     * 请求医生后端创建账单
     */
    Map<String, String> createSessionBill(SessionDetails session) throws BusinessException;

    /**
     * 结束会话的账单请求
     */
    Map<String, String> finishSessionBill(String sessionId, Long endTime, Integer freeFlg, Boolean isManual,
                                          Boolean isDeletePatient) throws BusinessException;

    /**
     * 结束会话-医生APP端通知消息
     */
    void finishSessionDrNotice(Long doctorId, SessionDetails session);

    /**
     * 结束会话-患者APP端通知消息
     */
    void finishSessionPtNotice(Long patientId, SessionDetails session, Long consultId) throws BusinessException;

    /**
     * 付费咨询检查患者是否需要支付会话
     */
    ConsultPayVO requirePaySession(Long patientId, Long doctorId) throws BusinessException;

    /**
     * 结束有效会话通知(患者端完成付费会话医生加分)
     */
    void finishValidSession(String sessionId, Long doctorId, Long patientId, final Integer consultSourceType);

    /**
     * 结束无效会话通知((患者端完成付费会话退款))
     */
    void finishInvalidSession(String sessionId, Long doctorId, Long patientId, final Integer consultSourceType);

    /**
     * 用户登录校验
     */
    boolean checkPtToken(String patientId, String token) throws BusinessException;

    /**
     * 用户登录校验-医生
     */
    boolean checkDrToken(String doctorId, String token) throws BusinessException;

    /**
     * 推药、病历消息获取用户信息
     */
    RecomUserInfoDTO getUserInfo(Long doctorId, Long patientId, boolean... fetchNickname) throws Exception;

    /**
     * 通知图文咨询服务会话已结束
     */
    void noticeSessionEndToConsult(String sessionId, Integer isValid);

}
